/*
 * Last review by   : Yaser
 * Last review date : JUL-25-09 
 */
using ERP.Framework.Components.LoggingHelper.ErrorLog;

namespace ERP.Framework.Components.DatabaseHelper
{
    /// <summary>
    /// Interface for DB connectors
    /// </summary>
    public interface IDataBaseConnector
    {
        #region Properties

        /// <summary>
        /// Gets or sets the connection string.
        /// </summary>
        /// <value>The connection string.</value>
        string ConnectionString { get; set; }

        /// <summary>
        /// Gets or sets the type of the error log.
        /// </summary>
        /// <value>The type of the error log.</value>
        ErrorLogType ErrorLogType { get; set; }

        /// <summary>
        /// Gets or sets the error log file path.
        /// </summary>
        /// <value>The exceptions log file path
        /// in case the log type was XML file</value>
        string ErrorLogFilePath { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Excecute update or insert statment
        /// </summary>
        /// <param name="type">stored proc/ text</param>
        /// <param name="command">command text</param>
        /// <param name="parameters">params collection</param>
        /// <returns>count of effected rows</returns>
        int Save(CommandType type, string command, ParametersCollection parameters);

        /// <summary>
        /// Executes a select statement
        /// </summary>
        /// <param name="type">stored proc/ text</param>
        /// <param name="command">command text</param>
        /// <param name="parameters">params collection</param>
        /// <returns>table contains the query result</returns>
        System.Data.DataTable Read(CommandType type, string command, ParametersCollection parameters);

        /// <summary>
        /// Executes a select statement that returns one value [count, max ,...]
        /// </summary>
        /// <param name="type">stored proc/ text</param>
        /// <param name="command">command text</param>
        /// <param name="parameters">params collection</param>
        /// <returns>object contains the query result</returns>
        object ReadScalar(CommandType type, string command, ParametersCollection parameters);

        #endregion
    }
}
